package com.tsystems.school.jabber.DataBase.DAO;

import com.tsystems.school.jabber.DataBase.Entities.Server;
import org.hibernate.HibernateException;

/**
 * Created by IntelliJ IDEA.
 * User: Kirill
 * Date: 25.08.11
 * Time: 4:23
 * To change this template use File | Settings | File Templates.
 */
public class ServerDAO extends GenericDAO<Server>{
	private String serverName = "first";
	public ServerDAO(Class<Server> type) {
		super(type);
	}

	public Server getThisServer(){
	    Server server=null;
		try{
			startTransaction();
			server = (Server) session.createQuery("from Server where name=?")
					.setString(0,serverName)
					.uniqueResult();
			tx.commit();
		} catch (HibernateException he){
			handleHibernateException(he);
		}
		return server;
	}
}
